<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

    <script src="./axios.min.js"></script>
</head>

<body>
    <!-- 
        Promise  
        1、异步对象
        2、有两个参数
        3、有.then()=====必须是Promise对
     -->

    <script>

        axios.interceptors.request.use(function (config) {
           
            return config;
        }, function (err) {
            console.log(err)
        })

        axios.interceptors.response.use(function (res) {
            
            return res.data;
        }, function (err) {
            console.log(err)
        })
        console.log(axios('http://127.0.0.1:3000/fdata'));

        //  axios('http://127.0.0.1:3000/fdata').then(res=>{
        //     console.log(res,11);

        //  })

        // function  bb(){}

        var aa = async function () {
            // var { data: res } = await 2('http://127.0.0.1:3000/fdata')
            // console.log(res, 888);

            var data = await axios('http://127.0.0.1:3000/fdata')
            console.log(data, 888);
        }
        aa()
    </script>



</body>

</html>